package com.json.dao.impl;

import com.json.dao.UserDAO;
import com.json.entity.User;
import com.json.util.JDBCUtils;

import java.util.List;

/*
*用户数据访问接口实现类
*/
public class UserDAOImpl implements UserDAO {

    /*
     * 通过用户名查询用户
     * @param username
     * @return
     */

    @Override
    public User selectUserByUsername(String username) {
        List<User> users = JDBCUtils.query(User.class,"select * from t_user where username = ?",username);
        if (users.size() >0){
            return  users.get(0);
        }
        return null;
    }
}
